/*
 * @FilePath: routes.ts
 * @@author: wjj
 * @Date: 2024-10-10 14:33:08
 * @@Description: new js file
 */
import { sv } from 'element-plus/es/locale'
import type { RouteRecordRaw } from 'vue-router'
//定义路由类型
// interface routeType {
//   path: string
//   component?: () => Promise<typeof import('*.vue')>
//   name: string
//   meta?: { title: string; hidden: boolean; icon: string }
//   redirect?: string
//   children?: {
//     path?: string
//     component?: () => Promise<typeof import('*.vue')>
//     meta?: { title: string; hidden: boolean; icon: string }
//   }[]
// }
//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
const constantRoute: RouteRecordRaw[] = []
const constantRoute2 = [
  {
    //登录
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'login',
    meta: {
      title: '登录', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
      icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
      svg_icon: '',
    },
  },
  {
    //登录
    path: '/auth_login',
    component: () => import('@/views/login/auth_login.vue'),
    name: 'auth_login',
    meta: {
      title: 'auth登录', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
      icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
      svg_icon: '',
    },
  },
  {
    path: '/test',
    component: () => import('@/views/fastboot/TestView.vue'),
    name: 'app路由',
    meta: {
      title: '路由', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
      icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
      svg_icon: '',
    },
  },
  {
    //404
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',
    meta: {
      title: '404',
      hidden: true,
      icon: 'DocumentDelete',
      svg_icon: '',
    },
  },
  {
    //登录
    path: '/yingmo',
    component: () => import('@/views/tools/test.vue'),
    name: '测试',
    meta: {
      title: '演示', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
      icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
      svg_icon: '',
    },
  },
  {
    path: '/until',
    component: () => import('@/layout/index.vue'),
    name: 'until',
    meta: {
      title: '效能工具',
      icon: '',
      svg_icon: 'sudu',
    },
    redirect: '/Nimi/chat',
    children: [
      {
        path: '/Nimi/chat',
        component: () => import('@/views/nimi/chats/chat.vue'),
        name: 'NimiChat',
        meta: {
          hidden: false,
          title: '聊天室',
          icon: '',
          svg_icon: 'chat',
        },
      },
      {
        path: '/Nimi/test',
        component: () => import('@/views/nimi/chats/test.vue'),
        name: 'Nimitest',
        meta: {
          hidden: true,
          title: '测试',
          icon: 'Iphone',
          svg_icon: '',
        },
      },
      {
        path: '/Nimi/account',
        component: () => import('@/views/nimi/chats/account.vue'),
        name: 'NimiAccount',
        meta: {
          hidden: false,
          title: '账号Token管理',
          icon: '',
          svg_icon: 'account',
        },
      },
      {
        path: '/Nimi/files',
        component: () => import('@/views/nimi/chats/files.vue'),
        name: 'Files',
        meta: {
          hidden: false,
          title: '文件管理',
          icon: '',
          svg_icon: 'account',
        },
      },
    ],
  },
  {
    path: '/fastboot',
    component: () => import('@/layout/index.vue'),
    name: 'fastboot',
    meta: {
      title: 'Fastboot',
      icon: '',
      svg_icon: 'fastboot',
    },
    redirect: '/fastboot/device-app-v2',
    children: [
      {
        path: '/fastboot/device-app-v2',
        component: () => import('@/views/fastboot/DeviceAppViewV2.vue'),
        name: 'DeviceAppV2',
        meta: {
          hidden: false,
          title: '测试执行',
          icon: '',
          svg_icon: 'test',
        },
      },
      {
        path: '/fastboot/reports-v2',
        component: () => import('@/views/fastboot/ReportsViewV2.vue'),
        name: 'ReportsV2',
        meta: {
          hidden: false,
          title: '测试报告',
          icon: '',
          svg_icon: 'report',
        },
      },
      {
        path: '/fastboot/route-manage-v2',
        component: () => import('@/views/fastboot/RouteManageViewV2.vue'),
        name: 'RouteManageV2',
        meta: {
          hidden: false,
          title: '路由管理',
          icon: '',
          svg_icon: 'route',
        },
      },
      {
        path: '/fastboot/app-install-v2',
        component: () => import('@/views/fastboot/AppInstallViewV2.vue'),
        name: 'AppInstallV2',
        meta: {
          hidden: false,
          title: '应用安装',
          icon: '',
          svg_icon: 'install',
        },
      },
      {
        path: '/fastboot/lit-decrypt',
        component: () => import('@/views/fastboot/LitDecryptView.vue'),
        name: 'LitDecrypt',
        meta: {
          hidden: false,
          title: 'Lit解密工具',
          icon: '',
          svg_icon: 'lit',
        },
      },
      {
        path: '/fastboot/chat-v2',
        component: () => import('@/views/fastboot/ChatViewV2.vue'),
        name: 'ChatV2',
        meta: {
          hidden: true,
          title: 'AI助手',
          icon: '',
          svg_icon: 'ai',
        },
      },
      {
        path: '/fastboot/reports-v2/:id',
        component: () => import('@/views/fastboot/ReportDetailViewV2.vue'),
        name: 'ReportDetail',
        meta: {
          hidden: true,
          title: '报告详情',
          icon: 'ChatDotRound',
        },
      },
    ],
  },
  {
    path: '/performance',
    component: () => import('@/layout/index.vue'),
    name: 'performance',
    meta: {
      title: '性能测试',
      icon: '',
      hidden: false,
      svg_icon: 'ai',
    },
    redirect: '/performance/index',
    children: [
      {
        path: '/performance/automation',
        component: () => import('@/views/performance/AutomationView.vue'),
        name: 'PerformanceAutomation',
        meta: {
          title: '性能测试报告',
          icon: '',
          hidden: false,
          svg_icon: 'report',
        },
      },
      {
        path: '/performance/index',
        component: () => import('@/views/performance/BuildAnalytics.vue'),
        name: 'BuildAnalytics',
        meta: {
          title: '编译分析',
          icon: 'DataLine',
          hidden: false,
        },
      },
      {
        path: '/performance/report-detail/:id',
        component: () =>
          import('@/views/performance/ReportDetailViewForPerformance.vue'),
        name: 'ReportDetailForPerformance',
        meta: {
          hidden: true,
          title: '性能测试报告详情',
          icon: 'ChatDotRound',
        },
      },
    ],
  },
  {
    path: '/docs',
    component: () => import('@/layout/index.vue'),
    name: 'docs',
    meta: {
      title: '项目文档',
      hidden: true,
      icon: '',
      svg_icon: 'copyright',
    },
    redirect: '/docs/overview',
    children: [
      {
        path: '/docs/overview',
        component: () => import('@/views/docs/index.vue'),
        name: 'Docs',
        meta: {
          hidden: false,
          title: '项目文档',
          icon: 'Document',
        },
      },
    ],
  },
]

//异步路由
export const asnycRoute = [
  {
    path: '/acl',
    component: () => import('@/layout/index.vue'),
    name: 'Acl',
    meta: {
      title: '权限管理',
      icon: '',
      svg_icon: 'acl',
    },
    redirect: '/acl/user',
    children: [
      {
        path: '/acl/user',
        component: () => import('@/views/acl/user/index.vue'),
        name: 'User',
        meta: {
          title: '用户管理',
          icon: 'User',
        },
      },
      {
        path: '/acl/role',
        component: () => import('@/views/acl/role/index.vue'),
        name: 'Role',
        meta: {
          title: '角色管理',
          icon: 'UserFilled',
        },
      },
      {
        path: '/acl/permission',
        component: () => import('@/views/acl/permission/index.vue'),
        name: 'Permission',
        meta: {
          title: '菜单管理',
          icon: 'Monitor',
        },
      },
    ],
  },
  {
    path: '/product',
    component: () => import('@/layout/index.vue'),
    name: 'Product',
    meta: {
      title: '测试商品管理',
      icon: '',
      svg_icon: 'shopping',
      hidden: true,
    },
    redirect: '/product/trademark',
    children: [
      {
        path: '/product/trademark',
        component: () => import('@/views/product/trademark/index.vue'),
        name: 'Trademark',
        meta: {
          title: '品牌管理',
          icon: 'ShoppingCartFull',
          hidden: false,
        },
      },
      {
        path: '/product/attr',
        component: () => import('@/views/product/attr/index.vue'),
        name: 'Attr',
        meta: {
          title: '属性管理',
          icon: 'ChromeFilled',
          hidden: false,
        },
      },
      {
        path: '/product/spu',
        component: () => import('@/views/product/spu/index.vue'),
        name: 'Spu',
        meta: {
          title: 'SPU管理',
          icon: 'Calendar',
          hidden: false,
        },
      },
      {
        path: '/product/sku',
        component: () => import('@/views/product/sku/index.vue'),
        name: 'Sku',
        meta: {
          title: 'SKU管理',
          icon: 'Orange',
          hidden: false,
        },
      },
    ],
  },
  {
    path: '/Interface',
    component: () => import('@/layout/index.vue'),
    name: 'Interface',
    meta: {
      title: '接口自动化',
      icon: '',
      svg_icon: 'API',
    },
    redirect: '/Interface/report',
    children: [
      {
        path: '/Interface/env',
        component: () => import('@/views/interface/Api_env.vue'),
        name: 'InterfaceEnv',
        meta: {
          hidden: false,
          title: '项目管理',
          icon: '',
          svg_icon: 'caseEnv',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/all_case',
        component: () => import('@/views/interface/Api_case.vue'),
        name: 'InterfaceAllCase',
        meta: {
          hidden: false,
          title: '测试模块',
          icon: '',
          svg_icon: 'caseModule',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/case',
        component: () => import('@/views/interface/Api_main.vue'),
        name: 'InterfaceCase',
        meta: {
          hidden: true,
          title: '接口用例',
          icon: '',
          svg_icon: 'api_report',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/caseReport',
        component: () => import('@/views/interface/Api_report.vue'),
        name: 'InterfaceCaseReport',
        meta: {
          hidden: false,
          title: '测试报告',
          icon: '',
          svg_icon: 'caseReport',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/caseReportDetail',
        component: () => import('@/views/interface/Api_report_detail.vue'),
        name: 'InterfaceCaseReportDetail',
        meta: {
          hidden: true,
          title: 'allure报告',
          icon: '',
          svg_icon: 'api_report',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/report',
        component: () => import('@/views/interface/report.vue'),
        name: 'InterfaceReport',
        meta: {
          hidden: false,
          title: 'API报告',
          icon: '',
          svg_icon: 'api_report',
          keepAlive: true,
        },
      },
      {
        path: '/Interface/reportError',
        component: () => import('@/views/interface/api_error.vue'),
        name: 'ReportError',
        meta: {
          hidden: true,
          title: 'API错误报告',
          icon: '',
          svg_icon: 'api_report',
          keepAlive: true,
        },
      },
    ],
  },
  {
    path: '/Nimi',
    component: () => import('@/layout/index.vue'),
    name: 'NiMi',
    meta: {
      title: 'Nimi',
      icon: '',
      svg_icon: 'nimi',
    },
    redirect: '/Nimi/gift-count',
    children: [
      {
        path: '/Nimi/gift-count',
        component: () => import('@/views/nimi/activity/gifi-count.vue'),
        name: 'GiftCount',
        meta: {
          hidden: false,
          title: '礼物概率统计',
          icon: '',
          svg_icon: 'gift',
          keepAlive: true,
        },
      },
      {
        path: '/Nimi/activity-gl',
        component: () => import('@/views/nimi/activity/activity-gl.vue'),
        name: 'activityGl',
        meta: {
          hidden: false,
          title: '活动记录与概率',
          icon: '',
          svg_icon: 'activity',
        },
      },
    ],
  },
  {
    path: '/3D',
    component: () => import('@/layout/index.vue'),
    name: '3D',
    meta: {
      title: '开发中...',
      icon: '',
      hidden: false,
      svg_icon: 'code',
    },
    redirect: '/3D/3DSHOW',
    children: [
      {
        path: '/3D/3DSHOW',
        component: () => import('@/3D/3DSHOW/index.vue'),
        name: '3DS',
        meta: {
          title: '3D展示',
          hidden: false,
          icon: 'Money',
        },
      },
      {
        path: '/3D/tuo',
        component: () => import('@/3D/3DSHOW/tuo.vue'),
        name: 'tuo',
        meta: {
          title: 'tuo展示',
          hidden: true,
          icon: 'Money',
        },
      },
      {
        path: '/3D/qiu',
        component: () => import('@/3D/3DSHOW/qiu.vue'),
        name: 'earth',
        meta: {
          title: '3D地球',
          hidden: false,
          icon: 'Money',
        },
      },
      {
        path: '/3D/test',
        component: () => import('@/views/components/draggable/test.vue'),
        name: 'test',
        meta: {
          title: '低代码组件',
          hidden: false,
          icon: 'Money',
        },
      },
    ],
  },
  {
    path: '/monitor',
    component: () => import('@/layout/index.vue'),
    name: 'monitor',
    meta: {
      title: '监控服务',
      icon: '',
      hidden: false,
      svg_icon: 'monitor',
    },
    redirect: '/monitor/flower',
    children: [
      {
        path: '/monitor/flower',
        component: () => import('@/views/monitor/celery_flower.vue'),
        name: 'flower',
        meta: {
          title: '消息队列',
          hidden: false,
          icon: '',
          svg_icon: 'celery',
        },
      },
      {
        path: '/monitor/grafana',
        component: () => import('@/views/monitor/grafana.vue'),
        name: 'grafana',
        meta: {
          title: '服务性能监控',
          hidden: false,
          icon: '',
          svg_icon: 'CPU',
        },
      },
      {
        path: '/monitor/rabbitmq',
        component: () => import('@/views/monitor/rabbitmq.vue'),
        name: 'rabbitmq',
        meta: {
          title: 'MQ+Dj',
          hidden: false,
          icon: '',
          svg_icon: 'RabbitMQ',
        },
      },
    ],
  },
  {
    path: '/screen',
    component: () => import('@/views/screen/index.vue'),
    name: 'Screen',
    meta: {
      hidden: false,
      title: '数据大屏(样本)',
      icon: '',
      svg_icon: 'ping2',
    },
  },
]

//任意路由
export const anyRoute = {
  //任意路由
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  name: 'Any',
  meta: {
    title: '任意路由',
    hidden: true,
    icon: 'DataLine',
  },
}

//路由集合
// import cer2 from './routes2'
const routeList = []
//测试路由
routeList.push(constantRoute2)
//正式路由
// constantRoute2.forEach((item) => {
//   constantRoute.push(item)
// })

//后续路由
routeList.forEach((items) => {
  items.forEach((item) => {
    constantRoute.push(item)
  })
})
//3D路由
constantRoute.push()
// constantRoute.push({
//   path: '/qiu',
//   // component: () => import('@/views/screen/index.vue'),
//   components: {
//     // key => value
//     // header: () => import('@/views/screen/index.vue'),
//     default: () => import('@/3D/3DSHOW/qiu.vue'), //默认省略不写name的情况
//     // footer: () => import('@/views/screen/index.vue')
//   },
//   name: 'qiu',
//   meta: {
//     hidden: false,
//     title: '3D地球',
//     icon: 'Money',
//   },
// })
export { constantRoute }
export const homeRoute = [
  {
    //登录成功以后展示数据的路由
    path: '/',
    component: () => import('@/layout/index.vue'),
    name: 'layout',
    meta: {
      title: '首页',
      hidden: false,
      icon: '',
      svg_icon: 'home',
    },
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: () => import('@/views/home/index.vue'),
        name: 'home',
        meta: {
          title: '首页',
          hidden: false,
          icon: 'HomeFilled',
        },
      },
    ],
  },
]
